package com.aac.rfcrabbitmvc.service.impl;

import com.aac.rfcrabbitmvc.dao.BaseDao;
import com.aac.rfcrabbitmvc.pojo.DatApplication;
import com.aac.rfcrabbitmvc.service.DatApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DatApplicationServiceImpl implements DatApplicationService {

    @Autowired
    private BaseDao<DatApplication> baseDao;

    @Override
    public DatApplication getDatApplicationByName(String appName) {
        List<DatApplication> datApplications = baseDao.queryHQL(
                "from DatApplication where appName=?", appName);
        if (datApplications.isEmpty()) {
            return null;
        } else {
            return datApplications.get(0);
        }
    }

}
